package com.yjhb.android.sbz.v2.activity.rule;

import android.widget.TextView;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.activity.BaseActivity;
import com.yjhb.android.sbz.v2.mvp.presenter.ConfigPresenter;
import com.yjhb.android.sbz.v2.mvp.view.ConfigView;
import com.jojo.android.zxlib.base.mvp.BasePresenter;

import org.jetbrains.annotations.Nullable;
import org.sufficientlysecure.htmltextview.HtmlHttpImageGetter;
import org.sufficientlysecure.htmltextview.HtmlTextView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建者 zx
 * 创建时间 2021/1/15 16:45
 */
public class V2RuleFissionRewardActivity extends BaseActivity implements ConfigView {
    private final String TAG = "RuleRewardActivity";
    @BindView(R.id.rule_title_tv)
    TextView rule_title_tv;
    @BindView(R.id.rule_tv)
    HtmlTextView rule_tv;

    private ConfigPresenter configPresenter;
    @Override
    protected BasePresenter initPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_rule_fission_reward;
    }

    @Override
    protected void initUI() {
        configPresenter = new ConfigPresenter(this);
        configPresenter.getSysConfig("FriendStageRule");
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void regEvent() {

    }

    @OnClick(R.id.back)
    void back() {
        finish();
    }

    @Override
    public void onConfig(@Nullable JSONObject config) {
        rule_title_tv.setText(config.getString("title"));
        rule_tv.setHtml(config.getString("rule"),new HtmlHttpImageGetter(rule_tv));
    }

    @Override
    public void onConfig(@Nullable JSONArray config) {

    }

    @Override
    public void onFailure(int code, String msg) {

    }
}
